<template>
	<view class="cdetail">
		<view v-for="item in plList" :key="item._id" class="li">
			<view class="con">
				<view>
					<img :src="item.imgurl" class="nc">
					<view class="zi">{{item.username}}</view>
				</view>
				<view class="right">{{item.time}}</view>
			</view>
			<view class="c1">
				<view class="zi1">{{item.fx}}</view>
				<view class="zi2">{{item.star}}分</view>
			</view>
			<view class="c2">
				<view>{{item.content}}</view>
			</view>
			<view class="c3">
				<view v-for="i in item.img">
					<img :src="i" alt="" class="img">
				</view>
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
import { ref,onMounted} from 'vue';
import { onLoad } from '@dcloudio/uni-app';
const detail = ref<any>({});
const plList = ref<any[]>([])
const loading = ref<boolean>(true);
onLoad((options) => {
  if (options.item) {
	try {
	  const itemStr = decodeURIComponent(options.item);
	  detail.value = JSON.parse(itemStr);
	  loading.value = false;
	} catch (error) {
	  console.error('解析数据失败:', error);
	}
  }
});	
const getlist1 = () => {
		uni.request({
			url: 'http://127.0.0.1:3000/ljy/comment',
			method: 'GET',
			data: {
				plList: plList.value,
				id: detail.value._id
			},
			success(res : any) {
				if (res.data.code == 200) {
					console.log(res.data.data);
					plList.value = res.data.data
				}
			}
		})
	}
	onMounted(() => {
		getlist1()
	})
</script>

<style scoped lang="scss">
.cdetail{
		padding: 25rpx;
		width: 750rpx;
		// padding-bottom: 100rpx;
		.li {
			padding-bottom: 60rpx;
			.con {
				display: flex;
				align-items: center;
				justify-content: space-between;
				
	
				view {
					display: flex;
					font-size: 14px;
	
					.nc {
						width: 80rpx;
						height: 80rpx;
						
						border-radius: 25px;
					}
	
					.zi {
						margin-top: 10px;
						padding-left: 20rpx;
					}
				}
	
				.right {
					padding-right: 60rpx;
					color: gray;
				}
			}
			.c1 {
				display: flex;
				justify-content: space-between;
				padding-right: 60rpx;
				padding-left: 100rpx;
				font-size: 14px;
				.zi1 {
					color: gray;
			
				}
			
				.zi2 {
					background-color: skyblue;
					width: 100rpx;
					text-align: center;
				}
			}
			
			.c2 {
				padding-right: 50rpx;
				padding-left: 100rpx;
				padding-top: 10rpx;
			}
			.c3{
				padding-left: 100rpx;
				display: flex;
				.img{
					padding-right: 20rpx;
					padding-top: 10rpx;
					width: 180rpx;
					height: 130rpx;
				}
			}
		}
}
</style>
